<template>
  <div>
    <Detail :detailForm="detailForm" @editHandle="editHandle"></Detail>
  </div>
</template>

<script setup>
import Detail from  '@/views/common/component/detail'
import { onMounted, reactive, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import {getTeacherDetail} from '@/api/teacher'
const router = useRouter()
const route = useRoute()
const detailForm = reactive({
  column:[
    {
      name:'姓名',
      code: 'name',
    },
    {
      name:'排序',
      code: 'orderNum',
    },
    {
      name:'学历',
      code: 'academic',
    },
    {
      name:'授课范围',
      code: 'teachScopeContent',
    },
    {
      name:'标签',
      code: 'tagContent',
    },
    {
      name:'介绍',
      code: 'introduce',
    },
    {
      name:'是否推荐首页',
      code: 'recommendFlag',
      formatter: (row)=>{
        return row.recommendFlag == 1? '是' : '否'
      }
    },
    {
      name:'头像',
      code: 'avatarPicUrl',
      isImage: true,
    },
  ],
  data: {},
  hasEdit: true
})
const initInfo = () => {
  getTeacherDetail(route.query.id || '').then((res) => {
    detailForm.data = res.data
  })
}
const editHandle = () => {
  router.push({
    path: '/modules/course/teacher/save',
    query: { id: route.query.id, type: 'edit' }
  })
}

onMounted(() => {
  initInfo()
})
</script>

<style></style>
